import {debounce} from "./utils";  //防抖函数
import BackTop from '@/components/content/backTop/BackTop'

export const itemListenerMixin = {
  data() {
    return {
      itemImgListener: null,
      refresh: null
    }
  },
  mounted() {
    this.refresh = debounce(this.$refs.scroll.refresh, 500)

    this.itemImgListener = () => {
      this.refresh()
    }
    this.$bus.$on('itemImageLoad', this.itemImgListener)
    // console.log("我是混入中的内容");
  }
}

export const backTopMixin = {
  components: {
    BackTop
  },
  data() {
    return {
      isShowBackTop: false
    }
  },
  methods: {
    backClick() {
      // console.log(this.$refs.scroll.message)  //哈哈哈
      //  @click.native="backClick"  访问原生组件成功

      this.$refs.scroll.scrollTo(0, 0)
    },
  }
}